package com.ihm;
import javax.swing.*;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class FenetreParcour extends JDialog {
	private JLabel labelparcour ;
	private JButton buttonajouter ;
	private JPanel panelhaut ;
	private JPanel panelmilieu ;
	private JPanel mainpanel ;
	private FenetreAjouterParcour feneterajouter ;
 	public FenetreParcour()
	{
		this.setTitle("Liste Parcour");
		this.setSize(800,600);
		this.setResizable(false);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		this.setModal(true);
		createcomponent();
		createpanel();
		addcomponent();
		this.add(mainpanel);
		event();
		this.setVisible(true);
	}
	
	public void  createcomponent()
	{
		labelparcour = new JLabel("Liste parcour");
		labelparcour.setFont(new Font("italique",Font.BOLD,20));
		buttonajouter = new JButton("Ajouter");
		buttonajouter.setMaximumSize(new Dimension(100,30));
		buttonajouter.setSize(100,30);
	}
	public void createpanel()
	{
		panelhaut = new JPanel();
		panelhaut.setLayout(new BoxLayout(panelhaut,BoxLayout.X_AXIS));
		panelmilieu = new JPanel();
		panelmilieu.setLayout(new BoxLayout(panelmilieu,BoxLayout.Y_AXIS));
		mainpanel = new JPanel();
		mainpanel.setLayout(new BoxLayout(mainpanel,BoxLayout.Y_AXIS));
	}
	public void  addcomponent()
	{
		panelhaut.add(labelparcour);
		panelhaut.add(Box.createHorizontalStrut(200));
		panelhaut.add(buttonajouter);
		panelhaut.add(Box.createVerticalGlue());
		mainpanel.add(panelhaut);
		mainpanel.add(Box.createVerticalGlue());
		mainpanel.add(panelmilieu);
	}
	public void createlist()
	{
		
	}
    public void event()
    {
    	buttonajouter.addMouseListener(new MouseListener(){

			@Override
			public void mouseClicked(MouseEvent arg0) {
				// TODO Auto-generated method stub
				feneterajouter = new FenetreAjouterParcour();
			}

			@Override
			public void mouseEntered(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseExited(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mousePressed(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseReleased(MouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
    		
    	});
    }
}
